export default {
    state: {
        name: 'zhangsan'
    },
    mutations: {
        updateName(state, payload) {
            state.name = payload
        }
    },
    getters: {
        fullName0(state) {
            return state.name + "-kuangtu"
        },
        fullName1(state, getters) {
            return getters.fullName0 + "-fawai"
        },
        fullName2(state, getters, rootState) {
            return getters.fullName1 + rootState.count
        }
    },
    actions: {
        aUpdateName(context) {
            // moudle中的actions只会commit自己的mutations中的函数
            setTimeout(() => {
                context.commit('updateName', 'wangwu')
            }, 3000);
        }
    }
}